package com.ding.servicebase.exceptionmanage;

import com.ding.commonutils.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;


@ControllerAdvice
public class Exceptionopera {
  @ExceptionHandler(Exception.class)
   @ResponseBody
   public Result info(Exception e) {
      e.printStackTrace();
      return Result.error().message("程序有异常出现");
  }


  @ExceptionHandler(Dingexception.class)
    @ResponseBody
    public Result Dinfo(Dingexception dingexception){
      dingexception.printStackTrace();
      return Result.error().code(dingexception.getCode()).message(dingexception.getInfo());
  }

}
